#ifndef __LED_WS_H__
#define __LED_WS_H__

#include "typedef.h"

#ifdef _12F629
    #define LED_TRIS    TRISIO0
    #define LED_PORT    GPIO0
    #define ON_LED      GPIO0 = 0;
    #define OFF_LED     GPIO0 = 1;
    #define INV_LED     if(0 == GPIO0) {OFF_LED} else {ON_LED}

    #define SW_TRIS         TRISIO1
    #define SW_PULLUP       WPU1
    #define SW_IN           GPIO1
    #define SW_ACTIVE       1
    #define SW_INACTIVE     0
#endif

#ifdef _12F683
    #define LED_TRIS    TRISIO0
    #define LED_PORT    GP0
    #define ON_LED      GP0 = 0;
    #define OFF_LED     GP0 = 1;
    #define INV_LED     if(0 == GP0) {OFF_LED} else {ON_LED}

    #define SW_TRIS         TRISIO1
    #define SW_PULLUP       WPU1
    #define SW_IN           GP1
    #define SW_ACTIVE       1
    #define SW_INACTIVE     0
    
    #define SS_TRIS             v_SsActive
    #define SS_PULLUP           WPU5
    #define SS_INT_ANYCHANGE    IOC5
    #define SS                  GP5
    #define SS_ACTIVE           0
    #define SS_INACTIVE         1
#endif

#define LED_MODE_IDLE       0
#define LED_MODE_CHOP1      1
#define LED_MODE_CHOP2      2
#define LED_MODE_CHOP3      3
#define LED_MODE_CHOP4      4
#define LED_MODE_CHOP5      5

#define SW_MODE_IDLE            0
#define SW_MODE_ENTER_LEARN     1
#define SW_MODE_LEARNING        2
#define SW_MODE_ERASING         3
#define SW_MODE_QUIT_LEARN      4

extern bit SwStatus;
extern bit SwEvent;

extern volatile bit v_SsIn;
extern volatile bit v_SsOld;
extern volatile bit v_SsActive;

void LedSW_InitReset( void );
void LedSW_UpdateStatus(void);


#endif  //__LED_WS_H__